import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; //ChangeNotifier需要material素材库

class CnUserModel
{
  //定义字段属性

String? avatarMiddleThumbUrl;
String? birthday;
int? availableCoins;
String? country;
String? registerPkgName;
bool? isVip;
String? nickname;
int? auditStatus;
bool? isHavePassword;
String? avatarUrl;
bool? isMultiple;
bool? isRecharge;
bool? isSwitchNotDisturbIm;
int? praiseNum;
int? userType;
String? loginPkgName;
String? avatarThumbUrl;
int? gender;
int? level;
bool? isAnswer;
bool? isBlock;
bool? isInternal;
String? avatar;
int? age;
bool? isReview;
int? createTime;
bool? isSwitchNotDisturbCall;
int? followNum;
String? registerCountry;
String? userId;
String? portraitUrl;

  //构造函数
  CnUserModel({
    
@required this.avatarMiddleThumbUrl,
@required this.birthday,
@required this.availableCoins,
@required this.country,
@required this.registerPkgName,
@required this.isVip,
@required this.nickname,
@required this.auditStatus,
@required this.isHavePassword,
@required this.avatarUrl,
@required this.isMultiple,
@required this.isRecharge,
@required this.isSwitchNotDisturbIm,
@required this.praiseNum,
@required this.userType,
@required this.loginPkgName,
@required this.avatarThumbUrl,
@required this.gender,
@required this.level,
@required this.isAnswer,
@required this.isBlock,
@required this.isInternal,
@required this.avatar,
@required this.age,
@required this.isReview,
@required this.createTime,
@required this.isSwitchNotDisturbCall,
@required this.followNum,
@required this.registerCountry,
@required this.userId,
@required this.portraitUrl,

    });

  //工厂模型转化
  factory CnUserModel.coverFromJson(dynamic infoData) => 
  CnUserModel(
    avatarMiddleThumbUrl:infoData['avatarMiddleThumbUrl'],
    birthday:infoData['birthday'],
    availableCoins:infoData['avaavailableCoinstar'],
    country:infoData['country'],
    registerPkgName:infoData['registerPkgName'],
    isVip:infoData['isVip'],
    nickname:infoData['nickname'],
    auditStatus:infoData['auditStatus'],
    isHavePassword:infoData['isHavePassword'],
    avatarUrl:infoData['avatarUrl'],
    isMultiple:infoData['isMultiple'],
    isRecharge:infoData['isRecharge'],
    isSwitchNotDisturbIm:infoData['isSwitchNotDisturbIm'],
    praiseNum:infoData['praiseNum'],
    userType:infoData['userType'],
    loginPkgName:infoData['loginPkgName'],
    avatarThumbUrl:infoData['avatarThumbUrl'],
    gender:infoData['gender'],
    level:infoData['level'],
    isAnswer:infoData['isAnswer'],
    isBlock:infoData['isBlock'],
    isInternal:infoData['isInternal'],
    avatar:infoData['avatar'],
    age:infoData['age'],
    isReview:infoData['isReview'],
    createTime:infoData['createTime'],
    isSwitchNotDisturbCall:infoData['isSwitchNotDisturbCall'],
    followNum:infoData['followNum'],
    registerCountry:infoData['registerCountry'],
    userId:infoData['userId'],
    portraitUrl:infoData['portraitUrl'] ?? '',

    );

}

// class UserInfo extends ChangeNotifier{
//   UserModel ? _info;
//   UserModel ? get info => _info ?? null;
//   void setInfo(info){
//     _info = info;
//     notifyListeners();
//   }
// }